package cn.leon.controller;

import cn.leon.common.pojo.EasyUIDataGridResult;
import cn.leon.common.pojo.TaotaoResult;
import cn.leon.pojo.Item;
import cn.leon.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class ItemController {
    @Autowired
    private ItemService itemService;

    @RequestMapping("/item/list")
    @ResponseBody
    public EasyUIDataGridResult getItemList(Integer page,Integer rows){
        EasyUIDataGridResult easyUIDataGridResult = itemService.getItemList(page, rows);
        return easyUIDataGridResult;
    }

    @RequestMapping("/item/save")
    @ResponseBody
    public TaotaoResult saveItem(Item item,String desc){
        TaotaoResult taotaoResult = itemService.addItem(item, desc);
        return taotaoResult;
    }
}
